/**
 * Created with IntelliJ IDEA.
 * User: wenxiwen
 * Date: 2022/3/13
 * Time: 10:29
 * Description: No Description
 */
import java.util.Scanner;
public class TestDemo {
    public static void main(String[] args) {
        for (int i = 1000; i <= 2000; i++) {
            if((i % 4 == 0 && i % 100 != 0)||(i % 400 == 0)) {
                System.out.print(i+" ");
            }
        }
    }
    public static void main9(String[] args) {
        for (int i = 1; i <= 100; i++) {
            int j = 0;
            for (j = 2; j <= (int)Math.sqrt(i); j++) {
                    if(i % j == 0) {
                        break;
                    }
            }
            if(j > Math.sqrt(i)) {
                System.out.print(i+" ");
            }
        }
    }
    public static void main8(String[] args) {
        Scanner scan = new Scanner(System.in);
        int input= scan.nextInt();
        if(input % 2 != 0) {
            System.out.println("不是素数");
        } else {
            System.out.println("是素数");
        }
    }
    public static void main7(String[] args) {
        Scanner scan = new Scanner(System.in);
        int input = scan.nextInt();
        if(input > 18 && input <= 28) {
            System.out.println("青年");
        } else if(input > 28 && input <= 55) {
            System.out.println("中年");
        } else if(input > 55) {
            System.out.println("老年");
        } else {
            System.out.println("少年");
        }
    }
    public static void main6(String[] args) {
        for (int i = 0; i < 999 ; i++) {
            int tmp = i;
            int count = 0;

            while(tmp > 0) {
               tmp = tmp / 10;
               count++;
            }

            tmp = i;
            int num = 0;
            while(tmp > 0) {
                num+=Math.pow(tmp % 10,count);
                tmp = tmp / 10;
            }

            if(num == i) {
                System.out.print(i+" ");
            }
        }
    }
    public static void main5(String[] args) {
        int m = 24 ;
        int n = 18;
        while(m % n > 0) {
            int tmp = m % n;
            m = n;
            n = tmp;
        }
        System.out.println(n);
    }
    public static void main4(String[] args) {
        Scanner scan = new Scanner(System.in);
        int input = scan.nextInt();
        for (int i = 0; i < 32 ; i+=2) {
            System.out.print(((input >> i) & 1) + " ");
        }
        System.out.println();
        for (int i = 1; i <= 32 ; i+=2) {
            System.out.print(((input>> i ) & 1 )+ " ");
        }
    }
    public static void main3(String[] args) {
        int count=0;
        Scanner scan = new Scanner(System.in);
        int input = scan.nextInt();
        while(input>0) {
            input=input&(input-1);
            count++;
        }
        System.out.println(count);
    }
    public static void main2(String[] args) {
        int num=3;
        Scanner scan = new Scanner(System.in);
        while(num>0) {
            String str = "123456789";
            String input = scan.nextLine();
            if(str.equals(input)) {
                System.out.println("登录成功");
            } else {
                num--;
                System.out.println("输入错误你还有"+num+"机会");
            }
        }
    }
    public static void main1(String[] args) {
        for (int i = 1; i <= 9 ; i++) {
            for (int j = 1; j <= i; j++) {
                System.out.print(i+"*"+j+"="+i*j+" ");
            }
            System.out.println();
        }
    }
}